<script lang="ts" setup>
import { computed, ref } from "vue";
import { MachineSelect } from "@/components/business";

const props = defineProps({
  dialogVisible: Boolean
});

const machineId = ref("");

const emit = defineEmits(["update:dialogVisible", "submit"]);

const visible = computed({
  get() {
    return props.dialogVisible;
  },
  set(val: boolean) {
    emit("update:dialogVisible", val);
  }
});

const submit = () => {
  emit("submit", machineId.value);
  visible.value = false;
};
</script>
<template>
  <el-dialog v-model="visible" title="绑定机器" width="500">
    <machine-select v-model="machineId" />
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <el-button type="primary" @click="submit"> 确认 </el-button>
      </div>
    </template>
  </el-dialog>
</template>
